//统一管理项目中所有接口路径
import instance from "./request";
import qs from "qs"
//精品推荐
export const JingpinAPI = () => instance.get("/products/recommend")

//热门兑换
export const RemenAPI = () => instance.get("/products/hot")
/* export function JingpinAPI(){
    return instance.get("/products/recommend")
} */ //这种写法，考虑到this指向才会用，不考虑this指向一般都用箭头函数


//获取短信验证码的请求
export const SendSMS = (params) => instance.post("/sendSMS", qs.stringify(params));

//手机号验证登录请求
export const PhoneLoginAPI = (params) => instance.post("/phoneRegin", qs.stringify(params));

//微信扫码登录
export const WeixinLoginAPI = (params) => instance.post("/wechatUsers/PCLogin", qs.stringify(params));

//手机绑定微信请求 
export const BindPhoneAPI = (params) => instance.post("/wechatUsers/binding", qs.stringify(params));

//获取用户信息   
export const GetUserInAPI = () => instance.get('/shop/userProfiles');

//获取详情页数据
export const GoodDetailsAPI = id => instance.get(`/products/${id}`);

//加入购物车请求
export const AddtoCartAPI = (params) => instance.post("/shop/carts/add", qs.stringify(params));

//商品列表的请求  get请求，带参数的写法
export const GetListAPI = (params) => instance.get("/products", { params })

//请求购物车数据
export const ViewShoppingCartAPI = () => instance.get("/shop/carts")

//请求解绑
export const UnBindingAPI = () => instance.put("/wechatUsers/unbindingWeChat")

//请求删除商品
export const CartDelAPI = (params) => instance.delete(`/shop/carts?productIds=${params}`);